﻿using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Colorful.Models
{
    public partial class Event : BaseId
    {
        /// <summary>
        /// 数字Id
        /// </summary>
        public long NumberId { get; set; }
        /// <summary>
        /// 所属菜单
        /// </summary>
        public long MenuId { get; set; }
        /// <summary>
        /// 分类Id
        /// </summary>
        public int SortId { get; set; }
        /// <summary>
        /// 标题
        /// </summary>
        [BindField("标题")]
        public string Title { get; set; }
        /// <summary>
        /// 缩略图
        /// </summary>
        [BindField("缩略图", MenuFieldType.Image)]
        public string Photo { get; set; }
        /// <summary>
        /// Banner图片
        /// </summary>
        [BindField("Banner", MenuFieldType.Image)]
        public string Banner { get; set; }
        /// <summary>
        /// 视频
        /// </summary>
        [BindField("视频", MenuFieldType.Video)]
        public string Video { get; set; }
        /// <summary>
        /// 开始时间
        /// </summary>
        [BindField("开始时间", MenuFieldType.DateTime)]
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime StartDate { get; set; }
        /// <summary>
        /// 截止时间
        /// </summary>
        [BindField("截止时间", MenuFieldType.DateTime)]
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime EndDate { get; set; }
        /// <summary>
        /// 活动地点
        /// </summary>
        [BindField("活动地点")]
        public string Address { get; set; }
        /// <summary>
        /// 活动简介
        /// </summary>
        [BindField("活动简介", MenuFieldType.SmallEditor)]
        public string Summary { get; set; }
        /// <summary>
        /// 活动内容
        /// </summary>
        [BindField("活动内容")]
        public string Content { get; set; }
        /// <summary>
        /// 报名链接
        /// </summary>
        [BindField("活动链接")]
        public string Link { get; set; }
        /// <summary>
        /// 购票链接
        /// </summary>
        [BindField("购票链接")]
        public string BuyLink { get; set; }
        /// <summary>
        /// 报名人数上限
        /// </summary>
        [BindField("报名人数上限")]
        public int Limit { get; set; }
        /// <summary>
        /// 置顶数
        /// </summary>
        public int Likes { get; set; }
        /// <summary>
        /// 标签
        /// </summary>
        [BindField("标签")]
        public List<string> Tags { get; set; }
        /// <summary>
        /// 标记
        /// </summary>
        [BindField("特殊标识")]
        public List<int> Flags { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public long ByOrder { get; set; }
        /// <summary>
        /// 是否发布到前台
        /// </summary>
        public bool Publish { get; set; }
        /// <summary>
        /// 语言
        /// </summary>
        [BindField("语言")]
        public string Lang { get; set; }
        /// <summary>
        /// 审核状态
        /// </summary>
        public AuditingStatus AuditStatus { get; set; }

        #region Ignore
        /// <summary>
        /// 活动状态
        /// </summary>
        public EventStatus Status
        {
            get
            {
                if (this.StartDate > DateTime.Now)
                    return EventStatus.Coming;
                else if (DateTime.Now >= this.StartDate && DateTime.Now <= this.EndDate)
                    return EventStatus.Starting;
                else
                    return EventStatus.End;
            }
        }
        #endregion
    }
}